package com.neusoft.neu24.nep.controller;


import com.neusoft.neu24.nep.entity.Account;
import com.neusoft.neu24.nep.entity.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("wechat")
@CrossOrigin("*")
public class WechatPayController {


    @Autowired
    Environment  env;

    @RequestMapping("pay/{wxid}/{money}")
    public CommonResult pay(@PathVariable( "wxid" )String wxid, @PathVariable("money") Integer money)
    {
        Account account = new Account();
        account.setWxid(wxid);
        account.setBalance(money);
        account.setId((int )System.currentTimeMillis());
        System.out.println("WechatPayController.pay - - - > " +  env.getProperty("server.port"));
        return  CommonResult.sucess(account);
    }

}
